#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int num(int n)
{
	static int sum = 0;
	if (n)
	{
		int z = n* num(n - 1);
		return sum += z;
	}
	
	else
		return 1;
}
int main()
{
	int n = 0;
	int sum = 1;
	int count = 0;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		sum *= i;
		count += sum;
	}
	printf("%d\n", count);
	int b = num(n);
	printf("%d", b);
	return 0;
}